#pragma once
#include "Netbase.h"
#include "Common/sync.h"
#include <set>

using namespace XGC::common;
namespace XGC
{
	namespace net
	{
		class CMessageQueue	:	public IMessageQueue
		{
		public:
			CMessageQueue(xgc_void);
			~CMessageQueue(xgc_void);

		private:
			virtual INetPacket* SysMessage();
			virtual INetPacket* PopMessage();
			virtual xgc_void PushMessage( INetPacket*, bool bSystem = false );

			virtual xgc_ulong32 AddRef();
			virtual xgc_ulong32 Release();
		private:

			typedef std::list< INetPacket* > PacketList;
			PacketList	lstClient;
			PacketList	lstSystem;

			volatile long mRef, mIndex;

			section	mMsgGuard;
			section mSysGuard;
		};
	}
}